home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume22 / nn6.4 / part20 < prev    next >
Encoding:
Text File  |  1990-06-07  |  54.3 KB  |  2,042 lines

  1. Newsgroups: comp.sources.unix
  2. Subject: REPOST v22i054:  NN Newsreader, release 6.4, Part20/21
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: f47b9bb9 df15399e 12fc4738 f5c7ca7c
  5.  
  6. Submitted-by: "Kim F. Storm" <storm@texas.dk>
  7. Posting-number: Volume 22, Issue 54
  8. Archive-name: nn6.4/part20
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # Contents:  active.c conf/s-bsd4-2.h conf/s-sys5.h contrib/aspell db.h
  17. #   doc/RELEASE_NOTES fullname.c help/help.commands hostname.c
  18. #   inews/conf.h inews/nntp.h init.sample man/nncheck.1 man/nngrep.1
  19. #   match.c nnstats.sh nntp.h
  20. # Wrapped by storm@texas.dk on Sun May  6 18:20:22 1990
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. echo If this archive is complete, you will see the following message:
  23. echo '          "shar: End of archive 20 (of 22)."'
  24. if test -f 'active.c' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'active.c'\"
  26. else
  27.   echo shar: Extracting \"'active.c'\" \(2547 characters\)
  28.   sed "s/^X//" >'active.c' <<'END_OF_FILE'
  29. X/*
  30. X *    (c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
  31. X *
  32. X *    read/update incore copy of active file
  33. X */
  34. X
  35. X#include "config.h"
  36. X
  37. Xread_active_file(act, copy)
  38. XFILE *act, *copy;
  39. X{
  40. X    char line[512];
  41. X    register char *cp, *name;
  42. X    register group_header *gh, *gh1;
  43. X    group_header *add_new_group(), *lookup_no_alias();
  44. X    int must_update;
  45. X    register flag_type old_flag;
  46. X    
  47. X    Loop_Groups_Header(gh)
  48. X    gh->master_flag &= ~M_VALID;
  49. X
  50. X    while (fgets(line, 512, act)) {
  51. X    if (copy != NULL) fputs(line, copy);
  52. X    must_update = 0;
  53. X
  54. X    cp = line;
  55. X    while (*cp && isspace(*cp)) cp++; /* eat blank lines */
  56. X    if (*cp == NUL || *cp == '#') continue;
  57. X
  58. X    /* cp -> NAME space 00888 ... nl */
  59. X    name = cp;
  60. X    while (*cp != ' ') cp++;
  61. X    *cp++ = NUL;
  62. X
  63. X    gh = lookup_no_alias(name);
  64. X    if (gh == NULL) {
  65. X        /* new group */
  66. X        gh = add_new_group(name);
  67. X        if (gh == NULL) continue;
  68. X        must_update = 1;
  69. X    }
  70. X    
  71. X    while (*cp && isspace(*cp)) cp++;
  72. X    gh->last_a_article = atol(cp);
  73. X
  74. X    while (*cp && isdigit(*cp)) cp++;
  75. X    while (*cp && isspace(*cp)) cp++;
  76. X
  77. X    if (*cp == NUL) {
  78. X        log_entry('E', "Error in active file for entry %s", name);
  79. X        continue;
  80. X    }
  81. X
  82. X    gh->first_a_article = atol(cp);
  83. X    if (gh->first_a_article == 0) gh->first_a_article = 1;
  84. X    while (*cp && isdigit(*cp)) cp++;
  85. X    while (*cp && isspace(*cp)) cp++;
  86. X
  87. X    gh->master_flag |= M_VALID;
  88. X    if (gh->master_flag & M_IGNORE_G) continue;
  89. X
  90. X    old_flag = gh->master_flag & 
  91. X        (M_IGNORE_A | M_MODERATED | M_NOPOST | M_ALIASED);
  92. X    gh->master_flag &= 
  93. X        ~(M_IGNORE_A | M_MODERATED | M_NOPOST | M_ALIASED);
  94. X    
  95. X    switch (*cp) {
  96. X     default:
  97. X        break;
  98. X
  99. X     case 'x':
  100. X        gh->master_flag |= M_IGNORE_A;
  101. X        if ((old_flag & (M_IGNORE_A|M_ALIASED)) == M_IGNORE_A) continue;
  102. X        must_update++;
  103. X        break;
  104. X
  105. X     case 'm':
  106. X        gh->master_flag |= M_MODERATED;
  107. X        if (old_flag & M_MODERATED) continue;
  108. X        must_update++;
  109. X        break;
  110. X
  111. X     case 'n':
  112. X        gh->master_flag |= M_NOPOST;
  113. X        if (old_flag & M_NOPOST) continue;
  114. X        must_update++;
  115. X        break;
  116. X
  117. X     case '=':
  118. X        gh->master_flag |= M_ALIASED | M_IGNORE_A;
  119. X        if (old_flag & M_ALIASED) continue;
  120. X        while (*++cp && isspace(*cp)) cp++;
  121. X        name = cp;
  122. X        while (*cp && !isspace(*cp)) cp++;
  123. X        *cp = NUL;
  124. X        gh1 = lookup(name);
  125. X        gh->data_write_offset = (off_t)gh1->group_num;
  126. X        must_update = 1;
  127. X        break;
  128. X    }
  129. X
  130. X    if ((old_flag & M_ALIASED) && (gh->master_flag & M_ALIASED) == 0) {
  131. X        gh->data_write_offset = 0;
  132. X        gh->master_flag |= M_MUST_CLEAN;
  133. X        continue;
  134. X    }
  135. X        
  136. X    if (must_update && who_am_i == I_AM_MASTER)
  137. X        db_write_group(gh);
  138. X    }
  139. X}
  140. END_OF_FILE
  141.   if test 2547 -ne `wc -c <'active.c'`; then
  142.     echo shar: \"'active.c'\" unpacked with wrong size!
  143.   fi
  144.   # end of 'active.c'
  145. fi
  146. if test -f 'conf/s-bsd4-2.h' -a "${1}" != "-c" ; then 
  147.   echo shar: Will not clobber existing file \"'conf/s-bsd4-2.h'\"
  148. else
  149.   echo shar: Extracting \"'conf/s-bsd4-2.h'\" \(2628 characters\)
  150.   sed "s/^X//" >'conf/s-bsd4-2.h' <<'END_OF_FILE'
  151. X/*
  152. X *    This version is for BSD 4.2 systems
  153. X */
  154. X
  155. X
  156. X/*
  157. X *    Include header files containing the following definitions:
  158. X *
  159. X *         off_t, time_t, struct stat
  160. X */
  161. X
  162. X#include <sys/types.h>
  163. X#include <sys/stat.h>
  164. X
  165. X
  166. X/*
  167. X *    Define if your system has system V like ioctls
  168. X */
  169. X
  170. X#undef    HAVE_TERMIO            /* */
  171. X
  172. X/*
  173. X *    Define to use terminfo database.
  174. X *    Otherwise, termcap is used
  175. X */
  176. X
  177. X#undef    USE_TERMINFO            /* */
  178. X
  179. X/*
  180. X *    Specify the library (or libraries) containing the termcap/terminfo
  181. X *    routines.
  182. X *
  183. X *    Notice:  nn only uses the low-level terminal access routines
  184. X *    (i.e. it does not use curses).
  185. X */
  186. X
  187. X#define TERMLIB    -ltermlib
  188. X
  189. X/*
  190. X *    Define HAVE_STRCHR if strchr() and strrchr() are available
  191. X */
  192. X
  193. X#ifdef USE_STRINGS_H
  194. X#undef USE_STRINGS_H
  195. X#include <strings.h>
  196. X#else
  197. X#include <string.h>
  198. X#endif
  199. X
  200. X#undef HAVE_STRCHR            /* */
  201. X
  202. X/*
  203. X *    Define if a signal handler has type void (see signal.h)
  204. X */
  205. X
  206. X#undef    SIGNAL_HANDLERS_ARE_VOID    /* */
  207. X
  208. X/*
  209. X *    Define MICRO_ALARM to timeout in 0.1 seconds if possible
  210. X */
  211. X
  212. X#define MICRO_ALARM()    alarm(1)    /* could use setitimer ... */
  213. X
  214. X/*
  215. X *    Define if your system has BSD like job control (SIGTSTP works)
  216. X */
  217. X
  218. X#define HAVE_JOBCONTROL            /* */
  219. X
  220. X/*
  221. X *    Define if your system provides the "directory(3X)" access routines
  222. X *
  223. X *    If true, include the header file(s) required by the package below
  224. X *    (remember that <sys/types.h> or equivalent is included above)
  225. X *    Also typedef Direntry to the proper struct type.
  226. X */
  227. X
  228. X#define    HAVE_DIRECTORY            /* */
  229. X
  230. X#include <sys/dir.h>            /* BSD */
  231. X
  232. Xtypedef struct direct Direntry;        /* BSD */
  233. X
  234. X/*
  235. X *    Define if your system has a mkdir() library routine
  236. X */
  237. X
  238. X#define    HAVE_MKDIR            /* */
  239. X
  240. X/*
  241. X *    Define if your system provides a BSD like gethostname routine.
  242. X *    Otherwise, define HAVE_UNAME if uname() is avaiable.
  243. X */
  244. X
  245. X#define    HAVE_GETHOSTNAME    /* BSD systems */
  246. X
  247. X/*
  248. X *    Define HAVE_MULTIGROUP if system has simultaneous multiple group
  249. X *    membership capability (BSD style).
  250. X */
  251. X
  252. X#define HAVE_MULTIGROUP
  253. X
  254. X/*
  255. X *    Define DETATCH_TERMINAL to be a command sequence which
  256. X *    will detatch a process from the control terminal
  257. X *    Also include system files needed to perform this HERE.
  258. X *    If not possible, just define it (empty)
  259. X */
  260. X
  261. X#include <sys/file.h>    /* for O_RDONLY */
  262. X#include <sys/ioctl.h>    /* for TIOCNOTTY */
  263. X
  264. X#define    DETATCH_TERMINAL \
  265. X    { int t = open("/dev/tty", O_RDONLY); \
  266. X      if (t >= 0) ioctl(t, TIOCNOTTY, (int *)0), close(t); }
  267. X
  268. X
  269. X/*
  270. X *    Specify where the Bourne Shell is.
  271. X */
  272. X
  273. X#define SHELL        "/bin/sh"
  274. X
  275. X/*
  276. X *    Specify the default mailer to be invoked by nnmail
  277. X */
  278. X
  279. X#define    MAILX    "/usr/ucb/Mail"        /* BSD */
  280. X
  281. X/*
  282. X *    Define the maximum length of any pathname that may occur
  283. X */
  284. X
  285. X#define    FILENAME     256
  286. END_OF_FILE
  287.   if test 2628 -ne `wc -c <'conf/s-bsd4-2.h'`; then
  288.     echo shar: \"'conf/s-bsd4-2.h'\" unpacked with wrong size!
  289.   fi
  290.   # end of 'conf/s-bsd4-2.h'
  291. fi
  292. if test -f 'conf/s-sys5.h' -a "${1}" != "-c" ; then 
  293.   echo shar: Will not clobber existing file \"'conf/s-sys5.h'\"
  294. else
  295.   echo shar: Extracting \"'conf/s-sys5.h'\" \(2736 characters\)
  296.   sed "s/^X//" >'conf/s-sys5.h' <<'END_OF_FILE'
  297. X/*
  298. X *    This is a generic System V Release 2 & 3 file.
  299. X *
  300. X *    If you need to modify anything, make a new s- file,
  301. X *    #include this file, and #define or #undef a few symbols.
  302. X */
  303. X
  304. X
  305. X/*
  306. X *    Include header files containing the following definitions:
  307. X *
  308. X *         off_t, time_t, struct stat
  309. X */
  310. X
  311. X#ifdef lint
  312. Xstruct proc {    /* sys/types.h references this on many systems */
  313. X    int keep_lint_happy;
  314. X};
  315. X#endif
  316. X
  317. X#include <sys/types.h>
  318. X#include <sys/stat.h>
  319. X
  320. X/*
  321. X *    Define if your system has system V like ioctls
  322. X */
  323. X
  324. X#define    HAVE_TERMIO            /* */
  325. X
  326. X/*
  327. X *    Define to use terminfo database.
  328. X *    Otherwise, termcap is used
  329. X */
  330. X
  331. X#define    USE_TERMINFO            /* */
  332. X
  333. X/*
  334. X *    Specify the library containing the termcap/terminfo access routines.
  335. X *    Notice:  nn does not use curses.
  336. X *    Notice:  You must also specify whether termcap or terminfo is
  337. X *         used when you edit config.h (see below).
  338. X */
  339. X
  340. X#define    TERMLIB -lcurses
  341. X
  342. X/*
  343. X *    Define HAVE_STRCHR if strchr() and strrchr() are available
  344. X */
  345. X
  346. X#define HAVE_STRCHR            /* */
  347. X
  348. X/*
  349. X *    Define if a signal handler has type void (see signal.h)
  350. X */
  351. X
  352. X#define    SIGNAL_HANDLERS_ARE_VOID    /* */
  353. X
  354. X/*
  355. X *    Define if signals must be set again after they are caught
  356. X */
  357. X
  358. X#define    RESET_SIGNAL_WHEN_CAUGHT    /* */
  359. X
  360. X/*
  361. X *    Define MICRO_ALARM to timeout in 0.1 seconds if possible
  362. X */
  363. X
  364. X#define MICRO_ALARM()    alarm(1)    /* System V */
  365. X
  366. X/*
  367. X *    Define if your system has BSD like job control (SIGTSTP works)
  368. X */
  369. X
  370. X/* #define HAVE_JOBCONTROL            /* */
  371. X
  372. X/*
  373. X *    Define if your system provides the "directory(3X)" access routines
  374. X *
  375. X *    If true, include the header file(s) required by the package below
  376. X *    (remember that <sys/types.h> or equivalent is included above)
  377. X *    Also typedef Direntry to the proper struct type.
  378. X */
  379. X
  380. X#ifdef NO_DIRENT_H
  381. X#undef NO_DIRENT_H
  382. X#else
  383. X
  384. X#define    HAVE_DIRECTORY            /* */
  385. X
  386. X#include <dirent.h>            /* System V */
  387. Xtypedef struct dirent Direntry;        /* System V */
  388. X
  389. X#endif
  390. X
  391. X/*
  392. X *    Define if your system has a mkdir() library routine
  393. X */
  394. X
  395. X#define    HAVE_MKDIR            /* */
  396. X
  397. X/*
  398. X *    Define HAVE_GETHOSTNAME if your system provides a BSD like
  399. X *    gethostname routine.
  400. X *    Otherwise, define HAVE_UNAME if uname() is avaiable.
  401. X *    As a final resort, define HOSTNAME to the name of your system.
  402. X */
  403. X
  404. X#define    HAVE_UNAME            /* System V */
  405. X
  406. X/*
  407. X *    Define DETATCH_TERMINAL to be a command sequence which
  408. X *    will detatch a process from the control terminal
  409. X *    Also include files needed to perform this HERE.
  410. X *    If not possible, just define it (empty)
  411. X */
  412. X
  413. X#define    DETATCH_TERMINAL setpgrp();    /* System V */
  414. X
  415. X/*
  416. X *    Specify where the Bourne Shell is.
  417. X */
  418. X
  419. X#define SHELL        "/bin/sh"
  420. X
  421. X/*
  422. X *    Specify the default mailer to be invoked by nnmail
  423. X */
  424. X
  425. X#define    MAILX        "/usr/bin/mailx"    /* SV */
  426. X
  427. X/*
  428. X *    Define the maximum length of any pathname that may occur
  429. X */
  430. X
  431. X#define    FILENAME     256
  432. END_OF_FILE
  433.   if test 2736 -ne `wc -c <'conf/s-sys5.h'`; then
  434.     echo shar: \"'conf/s-sys5.h'\" unpacked with wrong size!
  435.   fi
  436.   # end of 'conf/s-sys5.h'
  437. fi
  438. if test -f 'contrib/aspell' -a "${1}" != "-c" ; then 
  439.   echo shar: Will not clobber existing file \"'contrib/aspell'\"
  440. else
  441.   echo shar: Extracting \"'contrib/aspell'\" \(2723 characters\)
  442.   sed "s/^X//" >'contrib/aspell' <<'END_OF_FILE'
  443. XFrom: davison@drivax.uucp (Wayne Davison)
  444. XDate: Thu, 19 Apr 90 13:47:07 PST
  445. XTo: storm@texas.dk
  446. XSubject: Our spelling checker installation
  447. X
  448. X *  An advanced front-end to ispell written in perl!
  449. X *  Your shell/kernel must handle the #! control.
  450. X *  Also look over the script if your ispell and perl is not in
  451. X *  /usr/local/bin.
  452. X *
  453. X *  To use this code, you will need to put it somewhere suitable and
  454. X *  set the variable 'spell-checker' to the full path of this program,
  455. X *  e.g.
  456. X *    set spell-checker /usr/local/bin/aspell
  457. X *
  458. X *  ++Kim
  459. X
  460. X
  461. XI also created a perl script to disect the article before sending it to the
  462. Xspelling checker -- it separates the header and the signature from the body,
  463. XPLUS it includes the Subject, Keywords, and Summmary lines in the article to
  464. Xbe checked.  After the checking is complete, it removes the .bak file, and
  465. Xreconstructs the article using the various pieces.
  466. X
  467. XThe source for aspell follow.
  468. X
  469. X \  /| / /|\/ /| /(_)        <--flip monitor over for neato effect!
  470. X(_)/ |/ /\|/ / |/  \
  471. X   (W    A Y   N   e)
  472. X
  473. X----8<------8<------8<------8<-----cut here----->8------>8------>8------>8----
  474. X#! /usr/local/bin/perl
  475. Xif ($#ARGV != $[) {
  476. X    print "Usage: aspell filename\n";
  477. X    exit 1;
  478. X}
  479. X$FILE = shift;                # get filename of file to check
  480. X$BODY = "/tmp/aspell$$";
  481. Xopen(FILE,$FILE);            # open file for input
  482. Xopen(BODY,">$BODY");            # open output file that we'll check
  483. Xwhile (<FILE>) {                # read a line
  484. X    last unless /^([ \t]|[^ \t]*:)(.*)/;    # quit at end of header
  485. X    $header[$#header+1] = $_;        # save header in array
  486. X    sw1: {                # write certain headers to output file
  487. X        /^Subject:(.*)/  && do {print BODY; last sw1;};
  488. X        /^Keywords:(.*)/ && do {print BODY; last sw1;};
  489. X        /^Summary:(.*)/  && do {print BODY; last sw1;};
  490. X    }
  491. X}
  492. Xprint BODY;                # write blank line to output file
  493. Xwhile (<FILE>) {            # keep reading if not @ EOF
  494. X    last if /^-- $/;        # quit if we find the signature
  495. X    print BODY;            # write line to output file
  496. X}
  497. Xdo {
  498. X    $sig[$#sig+1] = $_;        # save signature in array (if there)
  499. X} while (<FILE>);            # until EOF
  500. Xclose(BODY);
  501. Xclose(FILE);
  502. X
  503. Xsystem "/usr/local/bin/ispell", "$BODY";    # run ispell
  504. Xunlink "${BODY}.bak";                # rm .bak file
  505. X
  506. Xopen(FILE,">$FILE");            # open original file for output
  507. Xopen(BODY,$BODY);            # open body of article for input
  508. Xfor ($i = 0; $i <= $#header; $i++) {
  509. X    $_ = $header[$i];        # grab a header line
  510. X    sw2: {                # substitute spelling-checked versions
  511. X        /^Subject:(.*)/  && ($_ = <BODY>, last sw2);
  512. X        /^Keywords:(.*)/ && ($_ = <BODY>, last sw2);
  513. X        /^Summary:(.*)/  && ($_ = <BODY>, last sw2);
  514. X    }
  515. X    print FILE;            # re-write header
  516. X}
  517. Xwhile(<BODY>) {
  518. X    print FILE;            # re-write body
  519. X}
  520. Xfor ($i = 0; $i <= $#sig; $i++) {
  521. X    print FILE $sig[$i];        # re-write signature (if present)
  522. X}
  523. Xunlink "$BODY";                # clean up
  524. END_OF_FILE
  525.   if test 2723 -ne `wc -c <'contrib/aspell'`; then
  526.     echo shar: \"'contrib/aspell'\" unpacked with wrong size!
  527.   fi
  528.   # end of 'contrib/aspell'
  529. fi
  530. if test -f 'db.h' -a "${1}" != "-c" ; then 
  531.   echo shar: Will not clobber existing file \"'db.h'\"
  532. else
  533.   echo shar: Extracting \"'db.h'\" \(2870 characters\)
  534.   sed "s/^X//" >'db.h' <<'END_OF_FILE'
  535. X/*
  536. X *    (c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
  537. X *
  538. X *    DATABASE ORGANIZATION:
  539. X *
  540. X *    The central nn information is contained in following files:
  541. X *        DB_DIRECTORY/MASTER
  542. X *        DB_DIRECTORY/GROUPS
  543. X *        DB_DIRECTORY/DATA/nnn.x
  544. X *        DB_DIRECTORY/DATA/nnn.d
  545. X *
  546. X *     The MASTER file consists of a header and one entry for each news
  547. X *    group.  The sequence of the group headers defines the group
  548. X *    number associated with the group.
  549. X *
  550. X *     The GROUPS file contains the names of the news groups; the names
  551. X *    occur in the same sequence as in the MASTER file.
  552. X *
  553. X *    For each news group, the DATA directory contains two files whose
  554. X *    name is constructed from the group number 'nnn':
  555. X *
  556. X *        nnn.x    Index file
  557. X *        nnn.d    Data file
  558. X *
  559. X *    The index file provides a a mapping from article numbers to offsets
  560. X *    in the data file.
  561. X *
  562. X *    The data file contains the actual header data.  Each article is
  563. X *    represented by a Header, an array of Cross Postings, and the
  564. X *    strings representing the sender name and the article subject:
  565. X *
  566. X *        header
  567. X *        group_number 1 [ if cross posted ]
  568. X *        group_number 2
  569. X *        ...
  570. X *        sender name (null terminated) [if sender_length > 0]
  571. X *        subject (null terminated) [if subject_length > 0]
  572. X *
  573. X *    For a digest, cross posted groups are only specified for the
  574. X *    first entry (the header entry).
  575. X *
  576. X *    On disk, the article_number is negative for digest article
  577. X *    header and zero for following sub articles.
  578. X *
  579. X *    The format of the index and data files are specified below.
  580. X *
  581. X *    Unless NETWORK_DATABASE is defined, the database will
  582. X *    will contain machine dependent binary data.
  583. X */
  584. X
  585. X#ifdef NETWORK_DATABASE
  586. Xtypedef int32 cross_post_number;
  587. X#ifdef NETWORK_BYTE_ORDER
  588. X#define NETW_CROSS_INT(cp) cp
  589. X#define NETW_CROSS_EXT(cp) cp
  590. X#else
  591. X#define NETW_CROSS_INT(cp) ntohl(cp)
  592. X#define NETW_CROSS_EXT(cp) htonl(cp)
  593. X#endif
  594. X#else
  595. Xtypedef group_number cross_post_number;
  596. X#define NETW_CROSS_INT(cp) cp
  597. X#define NETW_CROSS_EXT(cp) cp
  598. X#endif
  599. X
  600. Xtypedef struct {
  601. X    article_number    dh_number;
  602. X
  603. X    time_stamp    dh_date; /* encoded Date: filed (not a time_t value!!) */
  604. X
  605. X    off_t    dh_hpos; /* absolute offset for first byte of header */
  606. X    off_t    dh_lpos; /* absolute offset for last byte of article */
  607. X    int16    dh_fpos; /* relative offset for first byte in article text */
  608. X
  609. X    int16    dh_lines;
  610. X    int8    dh_replies;
  611. X
  612. X    int8    dh_cross_postings;
  613. X    int8    dh_subject_length;
  614. X    int8    dh_sender_length;
  615. X} data_header;
  616. X
  617. X#define DBUF_SIZE    255
  618. X
  619. Xtypedef struct {
  620. X    int            dh_type;
  621. X
  622. X#define    DH_NORMAL        0
  623. X#define    DH_DIGEST_HEADER    1
  624. X#define DH_SUB_DIGEST        2
  625. X
  626. X    cross_post_number    dh_cross[DBUF_SIZE+1];
  627. X    char        dh_sender[DBUF_SIZE+1];
  628. X    char        dh_subject[DBUF_SIZE+1];
  629. X} data_dynamic_data;
  630. X
  631. X
  632. X/* open database files */
  633. X
  634. XFILE *open_data_file();
  635. X
  636. X/* data access */
  637. X
  638. Xoff_t get_index_offset(), get_data_offset();
  639. X
  640. Xextern data_header db_hdr;
  641. Xextern data_dynamic_data db_data;
  642. END_OF_FILE
  643.   if test 2870 -ne `wc -c <'db.h'`; then
  644.     echo shar: \"'db.h'\" unpacked with wrong size!
  645.   fi
  646.   # end of 'db.h'
  647. fi
  648. if test -f 'doc/RELEASE_NOTES' -a "${1}" != "-c" ; then 
  649.   echo shar: Will not clobber existing file \"'doc/RELEASE_NOTES'\"
  650. else
  651.   echo shar: Extracting \"'doc/RELEASE_NOTES'\" \(2841 characters\)
  652.   sed "s/^X//" >'doc/RELEASE_NOTES' <<'END_OF_FILE'
  653. XRelease 6.4.0 known problems
  654. X----------------------------
  655. X
  656. XProg:    nn
  657. XTitle:    G= in merged groups
  658. X
  659. X    When searching for a subject or author in a merged group using
  660. X    G = .... only the group of the most recently accessed article
  661. X    is searched.
  662. X
  663. XProg:    nnmaster
  664. XTitle:    initial collection of news should use get_article_list
  665. X
  666. X    Explicitly requesting all articles in the range min..last is
  667. X    wasteful.  A better method would be to use the get_article_list
  668. X    method used by expire method 1.
  669. X
  670. XProg:    stdio
  671. XTitle:    handling of network errors
  672. X
  673. X        stdio is not well suited to handle network problems, and it is
  674. X    known to be slow as well.  A replacement is needed.
  675. X    
  676. XProg:    aux.sh
  677. XTitle:    RECMAIL must work
  678. X
  679. X    If the RECMAIL fails for some reason, the user is told so via
  680. X    mail - using RECMAIL.  It is checked during installation that
  681. X    the RECMAIL program exists, but not that it works.
  682. X
  683. XProg:    nnmaster
  684. XTitle:    Changes to GROUPS file should be detected automatically
  685. X
  686. X    It shouldn't be necessary to stop the master, run nnmaster -G,
  687. X    and restart the master if GROUPS is changed.
  688. X
  689. XProg:    nn
  690. XTitle:    .newsrc and select line length limited to 8k
  691. X
  692. X    There shouldn't be any limit on the length of lines in these
  693. X    files.
  694. X
  695. XProg:    nn
  696. XTitle:    Cannot reload init file
  697. X
  698. X    It should be possible to reload the init file or other files
  699. X    to have variable settings and presentation sequence on the
  700. X    fly.
  701. X    
  702. XProg:    nn
  703. XTitle:    macro syntax and init file differs
  704. X
  705. X    The syntax of macros shouldn't differ from the normal init
  706. X    file syntax.
  707. X
  708. XProg:    nn
  709. XTitle:    The confirm-entry function is done after menu collection
  710. X
  711. X    It should be done before spending time on collecting the menu.
  712. X
  713. XProg:    database
  714. XTitle:    keywords and summary are not stored in the database
  715. X
  716. X    Kill/select is not possible on keywords or summary, since they
  717. X    are not in the database.  The summary could also be used on
  718. X    the menu to annontate articles with identical subjects.
  719. X
  720. XProg:    nn
  721. XTitle:    Cannot follow thread in References: line
  722. X
  723. X    This is one of the major new facilities planned for 7.0.
  724. X    
  725. XProg:    nn
  726. XTitle:    Cannot go to "previous article" if it was in another group.
  727. X
  728. X    A "history menu" is planned for rel. 7.0 to overcome this.
  729. X
  730. X
  731. XProg:    nn - menu
  732. XTitle:    The , and / keys should scroll the menu rather than wrap around
  733. X
  734. X    It would be more logical that way.
  735. X
  736. XProg:    nn - options
  737. XTitle:    The -s and -n options cannot be combined.
  738. X    
  739. X    It could be useful to search for a specific subject from
  740. X    a specific sender.
  741. X    
  742. XProg:    nn - mail-format
  743. XTitle:    The "From " line could be more informative in mail-folders.
  744. X
  745. X    It should contain the poster's name rather than the group's
  746. X    name.
  747. X
  748. XProg:    nn
  749. XTitle:    Should look for more news before exiting.
  750. X
  751. X    News which has arrived in already read groups during news
  752. X    reading is not seen until the next invocation of nn.
  753. X
  754. XProg:    nn
  755. XTitle:    Shell layers are not supported.
  756. X
  757. X    ^Z is eaten by nn so shell layers don't work.
  758. END_OF_FILE
  759.   if test 2841 -ne `wc -c <'doc/RELEASE_NOTES'`; then
  760.     echo shar: \"'doc/RELEASE_NOTES'\" unpacked with wrong size!
  761.   fi
  762.   # end of 'doc/RELEASE_NOTES'
  763. fi
  764. if test -f 'fullname.c' -a "${1}" != "-c" ; then 
  765.   echo shar: Will not clobber existing file \"'fullname.c'\"
  766. else
  767.   echo shar: Extracting \"'fullname.c'\" \(2613 characters\)
  768.   sed "s/^X//" >'fullname.c' <<'END_OF_FILE'
  769. X/*
  770. X * This file is derived from Bnews' fullname.c file.
  771. X * Bnews is Copyright (c) 1986 by Rick Adams.
  772. X *
  773. X * NOTICE: THIS CODE HAS BEEN MODIFIED TO FIT THE NN ENVIRONMENT:
  774. X *
  775. X *    The full_name function has been rewritten entirely, although
  776. X *    there are still some structural resemblence.
  777. X *    Fullname checks $NAME before looking at /etc/passwd.
  778. X *    The LOCALNAME alternative has been removed, because it would fit
  779. X *    nn very poorly.
  780. X *    The buildfname function is made static and moved before full_name.
  781. X *
  782. X * fullname.c - this file is made separate so that different local
  783. X * conventions can be applied.  The stock version understands two
  784. X * conventions:
  785. X *
  786. X * (a) Berkeley finger: the gecos field in /etc/passwd begins with
  787. X *     the full name, terminated with comma, semicolon, or end of
  788. X *     field.  & expands to the login name.
  789. X * (b) BTL RJE: the gecos field looks like
  790. X *    : junk - full name ( junk :
  791. X *     where the "junk -" is optional.
  792. X *
  793. X * If you have a different local convention, modify this file accordingly.
  794. X */
  795. X
  796. X#ifdef SCCSID
  797. Xstatic char    *SccsId = "@(#)fullname.c    1.13    11/4/87";
  798. X#endif /* SCCSID */
  799. X
  800. X#include "config.h"
  801. X#include <pwd.h>
  802. X
  803. X/*
  804. X**  BUILDFNAME -- build full name from gecos style entry.
  805. X**    (routine lifted from sendmail)
  806. X**
  807. X**    This routine interprets the strange entry that would appear
  808. X**    in the GECOS field of the password file.
  809. X**
  810. X**    Parameters:
  811. X**        p -- name to build.
  812. X**        login -- the login name of this user (for &).
  813. X**        buf -- place to put the result.
  814. X**
  815. X**    Returns:
  816. X**        none.
  817. X**
  818. X**    Side Effects:
  819. X**        none.
  820. X*/
  821. X
  822. Xstatic buildfname(p, login, buf)
  823. X    register char *p;
  824. X    char *login;
  825. X    char *buf;
  826. X{
  827. X    register char *bp = buf;
  828. X
  829. X    if (*p == '*')
  830. X        p++;
  831. X    while (*p != '\0' && *p != ',' && *p != ';' && *p != ':' && *p != '(')
  832. X    {
  833. X        if (*p == '-' && (isdigit(p[-1]) || isspace(p[-1]))) {
  834. X            bp = buf;
  835. X            p++;
  836. X        }
  837. X        else if (*p == '&')
  838. X        {
  839. X            strcpy(bp, login);
  840. X            if ((bp == buf || !isalpha(bp[-1])) && islower(*bp))
  841. X                *bp = toupper(*bp);
  842. X            while (*bp != '\0')
  843. X                bp++;
  844. X            p++;
  845. X        }
  846. X        else
  847. X            *bp++ = *p++;
  848. X    }
  849. X    *bp = '\0';
  850. X}
  851. X
  852. X/*
  853. X * Figure out who is sending the message and sign it.
  854. X * We attempt to look up the user in the gecos field of /etc/passwd.
  855. X */
  856. Xchar *full_name()
  857. X{
  858. X    static char *fullname = NULL;
  859. X    char inbuf[FILENAME];
  860. X    struct passwd *pw, *getpwuid();
  861. X
  862. X    if (fullname == NULL) {
  863. X    if ((fullname = getenv("NAME")) != NULL)
  864. X        return fullname;
  865. X
  866. X    pw = getpwuid((int)user_id);
  867. X    if (pw == NULL) return fullname = "?";
  868. X
  869. X    buildfname(pw->pw_gecos, pw->pw_name, inbuf);
  870. X    if (inbuf[0] == 0) strcpy(inbuf, pw->pw_name);
  871. X
  872. X    fullname = copy_str(inbuf);
  873. X    }
  874. X    return fullname;
  875. X}
  876. END_OF_FILE
  877.   if test 2613 -ne `wc -c <'fullname.c'`; then
  878.     echo shar: \"'fullname.c'\" unpacked with wrong size!
  879.   fi
  880.   # end of 'fullname.c'
  881. fi
  882. if test -f 'help/help.commands' -a "${1}" != "-c" ; then 
  883.   echo shar: Will not clobber existing file \"'help/help.commands'\"
  884. else
  885.   echo shar: Extracting \"'help/help.commands'\" \(2870 characters\)
  886.   sed "s/^X//" >'help/help.commands' <<'END_OF_FILE'
  887. X;:ACOMMAND NAMES;:A                        ;:AMAP COMMAND;:A
  888. X
  889. X;:BNAME        MENU    MORE    FUNCTION
  890. Xadvance-article        A    advance to next article from menu
  891. Xadvance-group    A         advance one group in sequence
  892. Xarticle N        a-z    select article N (0..no of menu lines-1)
  893. Xback-article        B    go back one article from menu
  894. Xback-group    B         go back one group in sequence
  895. Xcancel        C    C    cancel an article
  896. Xcommand        :    :    extenced command prefix
  897. Xcompress        c    compress text (eliminate extra spaces)
  898. Xcontinue    SPACE    SPACE    the "space bar" command
  899. Xcontinue-no-mark CR    CR    as the "space bar" command, but don't mark
  900. Xdecode        :decode    :decode    decode uuencoded article(s)
  901. Xfind            /    regular expression search
  902. Xfind-next        .    repeat regular expression search
  903. Xfollow        F     f F    follow up
  904. Xfull-digest        H    show complete digest
  905. Xgoto-group    G    G    goto group or open folder
  906. Xgoto-menu        =    go back to menu
  907. Xhelp        ?    ?    online help
  908. Xjunk-articles    J        change marking of articles on the menu
  909. Xkill-select    K    K    kill/select handling
  910. Xlayout        L        change menu layout
  911. Xleave-article    l    l    leave (mark) article for later use
  912. Xline+1        down    CR    next menu line/scroll one line
  913. Xline-1        up        previous menu line
  914. Xline=@            g    goto specific line
  915. Xmacro N                invoke macro number N (0..100)
  916. Xmail        M    m M    mail or forward
  917. Xmessage        ^P    ^P    repeat last prompt line message
  918. Xnext-article        n    skip to next article
  919. Xnext-group    N        goto to next group without reading current
  920. Xnext-subject        k    skip to next article with different subject
  921. Xnil                unbound key
  922. Xoverview    Y    Y    show groups with unread news
  923. Xpage+1        >        goto next page if any
  924. Xpage+1/2        d ^D    scroll half page forward
  925. Xpage-1        <    DEL    goto one page back
  926. Xpage-1/2        u ^U    scroll half page backwards
  927. Xpage=$        $    $    goto end of menu/article
  928. Xpage=0            h    goto header of article
  929. Xpage=1        ^    ^    goto first menu/article page
  930. Xpage=@                goto specific page of article (not implemented)
  931. Xpatch        :patch    :patch    pipe article through patch program
  932. Xpost        :post    :post    post new article
  933. Xpreview        %        preview article
  934. Xprevious    P    p    goto previous group/article
  935. Xprint        :print    P    print article
  936. Xquit        Q    Q    quit nn
  937. Xread-return    Z        read selected articles and return to menu
  938. Xread-skip    X        read selected article, skip unseen menu pages
  939. Xredraw        ^L ^R    ^L ^R    redraw screen
  940. Xreply        R    r R    reply
  941. Xrot13            D    decrypt rot13 article
  942. Xsave-body    W    w W    save article without header
  943. Xsave-full    S    s S    save article with full header
  944. Xsave-short    O    o O    save article with short header
  945. Xselect          .        select (or deselect) current menu entry
  946. Xselect-auto     +        select "auto-selected" articles
  947. Xselect-invert     @        invert all selections on current menu page
  948. Xselect-range    -        select range of articles
  949. Xselect-subject    *        select all articles with current subject
  950. Xshell             !    !    shell command prefix
  951. Xskip-lines        TAB    skip lines starting with same char as last line
  952. Xunselect-all      ~        unselect all articles
  953. Xunshar                unshar article(s)
  954. Xunsub             U    U    unsubscribe (or subscribe) to current group
  955. Xversion           V    V    print release information
  956. END_OF_FILE
  957.   if test 2870 -ne `wc -c <'help/help.commands'`; then
  958.     echo shar: \"'help/help.commands'\" unpacked with wrong size!
  959.   fi
  960.   # end of 'help/help.commands'
  961. fi
  962. if test -f 'hostname.c' -a "${1}" != "-c" ; then 
  963.   echo shar: Will not clobber existing file \"'hostname.c'\"
  964. else
  965.   echo shar: Extracting \"'hostname.c'\" \(2359 characters\)
  966.   sed "s/^X//" >'hostname.c' <<'END_OF_FILE'
  967. X/*
  968. X *    (c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
  969. X *
  970. X *    "generic" gethostname() emulation:
  971. X * 
  972. X *    Possibilities are used in following order:
  973. X *
  974. X *    HAVE_GETHOSTNAME        -- use gethostname()
  975. X *    HAVE_UNAME            -- use sysV uname().nodename
  976. X *    HOSTNAME_FILE "/.../..."    -- read hostname from file
  977. X *    HOSTNAME_WHOAMI            -- use sysname from whoami.h
  978. X *    HOSTNAME "host"            -- hard-coded hostname
  979. X *    You lose!
  980. X */
  981. X
  982. X#include "config.h"
  983. X
  984. X#undef DONE
  985. X
  986. X#ifdef HAVE_GETHOSTNAME
  987. X/*
  988. X *    Easy -- we already got it
  989. X */
  990. X#define DONE
  991. X#endif
  992. X
  993. X#ifndef DONE
  994. X#ifdef HAVE_UNAME
  995. X/*
  996. X *    System V uname() is available.    Use nodename field.
  997. X */
  998. X
  999. X#include <sys/utsname.h>
  1000. X
  1001. Xgethostname(name, length)
  1002. Xchar *name;
  1003. Xint length;
  1004. X{
  1005. X    struct utsname un;
  1006. X
  1007. X    uname(&un);
  1008. X    strncpy(name, un.nodename, length);
  1009. X}
  1010. X#define DONE
  1011. X#endif
  1012. X#endif
  1013. X
  1014. X#ifndef DONE
  1015. X#ifdef HOSTNAME_FILE
  1016. X/*
  1017. X *    Hostname is available in a file.
  1018. X *    The name of the file is defined in HOSTNAME_FILE.
  1019. X *    This is not intended to fail (or exit would have been via nn_exit)
  1020. X */
  1021. X
  1022. Xgethostname(name, length)
  1023. Xchar *name;
  1024. Xint length;
  1025. X{
  1026. X    FILE *f;
  1027. X    register char *p;
  1028. X    
  1029. X    f = fopen(HOSTNAME_FILE, "r"); /* Generic code -- don't use open_file */
  1030. X    if (f == NULL) goto err;
  1031. X    if (fgets(name, length, f) == NULL) goto err;
  1032. X    if ((p = strchr(name, NL)) != NULL) *p = NUL;
  1033. X    fclose(f);
  1034. X    return;
  1035. X    
  1036. Xerr:    
  1037. X    fprintf(stderr, "HOSTNAME NOT FOUND IN %s\n", HOSTNAME_FILE);
  1038. X    exit(77);
  1039. X}
  1040. X#define DONE
  1041. X#endif
  1042. X#endif
  1043. X
  1044. X#ifndef DONE
  1045. X#ifdef HOSTNAME_WHOAMI
  1046. X/*
  1047. X *    Hostname is found in whoami.h
  1048. X */
  1049. X
  1050. Xgethostname(name, length)
  1051. Xchar *name;
  1052. Xint length;
  1053. X{
  1054. X    FILE *f;
  1055. X    char buf[512];
  1056. X    register char *p, *q;
  1057. X    
  1058. X    f = fopen("/usr/include/whoami.h", "r");
  1059. X    if (f == NULL) goto err;
  1060. X    
  1061. X    while (fgets(buf, 512, f) != NULL) {
  1062. X    if (buf[0] != '#') continue;
  1063. X    if ((p = strchr(buf, '"')) == NULL) continue;
  1064. X    *p++ = NUL;
  1065. X    if (strncmp(buf, "#define sysname", 15)) continue;
  1066. X    if ((q = strchr(p, '"')) == NULL) break;
  1067. X    *q = NUL;
  1068. X    strncpy(name, p, length);
  1069. X    return;
  1070. X    }
  1071. X    
  1072. X err:
  1073. X    fprintf(stderr, "HOSTNAME (sysname) NOT DEFINED IN whoami.h\n");
  1074. X    exit(77);
  1075. X}
  1076. X#define DONE
  1077. X#endif
  1078. X#endif
  1079. X
  1080. X#ifndef DONE
  1081. X#ifdef HOSTNAME
  1082. Xgethostname(name, length)
  1083. Xchar *name;
  1084. Xint length;
  1085. X{
  1086. X    strncpy(name, HOSTNAME, length);
  1087. X}
  1088. X#define DONE
  1089. X#endif
  1090. X#endif
  1091. X
  1092. X#ifndef DONE
  1093. XYOU LOSE ON GETHOSTNAME -- DEFINE HOSTNAME IN CONFIG.H
  1094. X#endif
  1095. END_OF_FILE
  1096.   if test 2359 -ne `wc -c <'hostname.c'`; then
  1097.     echo shar: \"'hostname.c'\" unpacked with wrong size!
  1098.   fi
  1099.   # end of 'hostname.c'
  1100. fi
  1101. if test -f 'inews/conf.h' -a "${1}" != "-c" ; then 
  1102.   echo shar: Will not clobber existing file \"'inews/conf.h'\"
  1103. else
  1104.   echo shar: Extracting \"'inews/conf.h'\" \(2825 characters\)
  1105.   sed "s/^X//" >'inews/conf.h' <<'END_OF_FILE'
  1106. X/*
  1107. X * Configuration file for nn version of nntp inews.  Written by
  1108. X * Steve Simmons (scs@lokkur.dexter.mi.us), Dec 19, 1989.  Placed
  1109. X * in the public domain by the author.  This file rationalizes
  1110. X * the stock NNTP release of inews with the definitions for NN.
  1111. X * The rationalization was done as of NN version 6.3.10 and NNTP
  1112. X * version 1.5.7.
  1113. X *
  1114. X * You must edit this file to reflect your local configuration
  1115. X * and environment.
  1116. X *
  1117. X * Follow the instructions given in the comments.  See the file
  1118. X * README for more comments.
  1119. X *
  1120. X * $RCSfile: conf.h,v $    $Revision: 1.1 $
  1121. X *
  1122. X * $Author: news $    $Date: 89/12/20 17:43:03 $
  1123. X *
  1124. X * $State: Exp $    $Locker:  $
  1125. X *
  1126. X * $Log:    conf.h,v $
  1127. X * Revision 1.1  89/12/20  17:43:03  news
  1128. X * Initial revision
  1129. X *
  1130. X * May 1st, 1990, Kim Storm
  1131. X * Modifications to get hostname for free (see README.NN)
  1132. X */
  1133. X
  1134. X#ifndef    NNINEWSCONF_H
  1135. X#define    NNINEWSCONF_H
  1136. X
  1137. X#include    "config.h"
  1138. X
  1139. X#ifndef NNTP
  1140. X/* WHY DO YOU WANT TO MAKE MINI-INEWS WHEN YOU DONT USE NNTP */
  1141. X#endif
  1142. X
  1143. X/*
  1144. X *  Define your local domain name.  You *must* define something here.
  1145. X *
  1146. X *  You are not strictly *required* to have a domain name; nonetheless
  1147. X *  it's a good idea.  If you are on the Internet or otherwise have a
  1148. X *  valid domain name, use it (except see HIDDENNET below).  If you're
  1149. X *  a uucp-only site, use ".uucp" for now and go get a real name.
  1150. X *
  1151. X *  Note that if you imbed your domain name in the hostname and you don't
  1152. X *  use HIDDENNET, you should comment out the definition.
  1153. X */
  1154. X
  1155. X#define    DOMAIN    "iti.org"
  1156. X
  1157. X/*
  1158. X *  If you define this, the hostname will not appear in the posting
  1159. X *  data except on the path.  Items will be from user@DOMAIN (with
  1160. X *  DOMAIN as defined above).  If you don't want this, comment it out.
  1161. X */
  1162. X
  1163. X#define    HIDDENNET
  1164. X
  1165. X/*
  1166. X *  There are a number of ways that inews will try to figure out the
  1167. X *  host name.  When used with nn, the definitions in ../config.h
  1168. X *  will specify this, so you don't have to do anything special here.
  1169. X */
  1170. X
  1171. X/*
  1172. X *  If you don't have bcopy, the following define will make one...
  1173. X */
  1174. X
  1175. X/* #define USG            /* */
  1176. X
  1177. X/*
  1178. X *  You shouldn't need to touch anything below this line.
  1179. X */
  1180. X
  1181. X/*
  1182. X *  This is the code needed to get the proper hostname.
  1183. X *
  1184. X *    nn provides a gethostname function for generic use.
  1185. X *    we fake uname() for inews.c using this:
  1186. X */
  1187. X
  1188. X#define    uname(str) gethostname(str, sizeof(str))
  1189. X
  1190. X/*
  1191. X *  Stock nntp inews and nn use some different #define names for the
  1192. X *  same general functions.  This synchronises them.
  1193. X */
  1194. X
  1195. X#define    SERVER_FILE    NNTP_SERVER
  1196. X
  1197. X/*
  1198. X *    Reverse engineering (nn got this the other way around)....
  1199. X */
  1200. X
  1201. X#ifdef HAVE_STRCHR
  1202. X#define    rindex strrchr
  1203. X#define index strchr
  1204. X#endif
  1205. X
  1206. X/*
  1207. X *  Sanity checks (You know.  Checks you get from Sanity Claus)
  1208. X */
  1209. X
  1210. X#ifdef    HIDDENNET
  1211. X#ifndef    DOMAIN
  1212. XYOU_BLEW_IT READ_THE_INSTRUCTIONS_AGAIN
  1213. X#endif
  1214. X#endif
  1215. X
  1216. X#endif    /* of ifdef NNINEWSCONF_H */
  1217. END_OF_FILE
  1218.   if test 2825 -ne `wc -c <'inews/conf.h'`; then
  1219.     echo shar: \"'inews/conf.h'\" unpacked with wrong size!
  1220.   fi
  1221.   # end of 'inews/conf.h'
  1222. fi
  1223. if test -f 'inews/nntp.h' -a "${1}" != "-c" ; then 
  1224.   echo shar: Will not clobber existing file \"'inews/nntp.h'\"
  1225. else
  1226.   echo shar: Extracting \"'inews/nntp.h'\" \(2530 characters\)
  1227.   sed "s/^X//" >'inews/nntp.h' <<'END_OF_FILE'
  1228. X/*
  1229. X * Response codes for NNTP server
  1230. X *
  1231. X * @(#)nntp.h    1.7    (Berkeley) 1/11/88
  1232. X *
  1233. X * First digit:
  1234. X *
  1235. X *    1xx    Informative message
  1236. X *    2xx    Command ok
  1237. X *    3xx    Command ok so far, continue
  1238. X *    4xx    Command was correct, but couldn't be performed
  1239. X *        for some specified reason.
  1240. X *    5xx    Command unimplemented, incorrect, or a
  1241. X *        program error has occured.
  1242. X *
  1243. X * Second digit:
  1244. X *
  1245. X *    x0x    Connection, setup, miscellaneous
  1246. X *    x1x    Newsgroup selection
  1247. X *    x2x    Article selection
  1248. X *    x3x    Distribution
  1249. X *    x4x    Posting
  1250. X */
  1251. X
  1252. X#define    CHAR_INF    '1'
  1253. X#define    CHAR_OK        '2'
  1254. X#define    CHAR_CONT    '3'
  1255. X#define    CHAR_ERR    '4'
  1256. X#define    CHAR_FATAL    '5'
  1257. X
  1258. X#define    INF_HELP    100    /* Help text on way */
  1259. X#define    INF_DEBUG    199    /* Debug output */
  1260. X
  1261. X#define    OK_CANPOST    200    /* Hello; you can post */
  1262. X#define    OK_NOPOST    201    /* Hello; you can't post */
  1263. X#define    OK_SLAVE    202    /* Slave status noted */
  1264. X#define    OK_GOODBYE    205    /* Closing connection */
  1265. X#define    OK_GROUP    211    /* Group selected */
  1266. X#define    OK_GROUPS    215    /* Newsgroups follow */
  1267. X#define    OK_ARTICLE    220    /* Article (head & body) follows */
  1268. X#define    OK_HEAD        221    /* Head follows */
  1269. X#define    OK_BODY        222    /* Body follows */
  1270. X#define    OK_NOTEXT    223    /* No text sent -- stat, next, last */
  1271. X#define    OK_NEWNEWS    230    /* New articles by message-id follow */
  1272. X#define    OK_NEWGROUPS    231    /* New newsgroups follow */
  1273. X#define    OK_XFERED    235    /* Article transferred successfully */
  1274. X#define    OK_POSTED    240    /* Article posted successfully */
  1275. X
  1276. X#define CONT_XFER    335    /* Continue to send article */
  1277. X#define    CONT_POST    340    /* Continue to post article */
  1278. X
  1279. X#define    ERR_GOODBYE    400    /* Have to hang up for some reason */
  1280. X#define    ERR_NOGROUP    411    /* No such newsgroup */
  1281. X#define    ERR_NCING    412    /* Not currently in newsgroup */
  1282. X#define    ERR_NOCRNT    420    /* No current article selected */
  1283. X#define    ERR_NONEXT    421    /* No next article in this group */
  1284. X#define    ERR_NOPREV    422    /* No previous article in this group */
  1285. X#define    ERR_NOARTIG    423    /* No such article in this group */
  1286. X#define ERR_NOART    430    /* No such article at all */
  1287. X#define ERR_GOTIT    435    /* Already got that article, don't send */
  1288. X#define ERR_XFERFAIL    436    /* Transfer failed */
  1289. X#define    ERR_XFERRJCT    437    /* Article rejected, don't resend */
  1290. X#define    ERR_NOPOST    440    /* Posting not allowed */
  1291. X#define    ERR_POSTFAIL    441    /* Posting failed */
  1292. X
  1293. X#define    ERR_COMMAND    500    /* Command not recognized */
  1294. X#define    ERR_CMDSYN    501    /* Command syntax error */
  1295. X#define    ERR_ACCESS    502    /* Access to server denied */
  1296. X#define ERR_FAULT    503    /* Program fault, command not performed */
  1297. X
  1298. X/* RFC 977 defines this; don't change it. */
  1299. X
  1300. X#define    NNTP_STRLEN    512
  1301. END_OF_FILE
  1302.   if test 2530 -ne `wc -c <'inews/nntp.h'`; then
  1303.     echo shar: \"'inews/nntp.h'\" unpacked with wrong size!
  1304.   fi
  1305.   # end of 'inews/nntp.h'
  1306. fi
  1307. if test -f 'init.sample' -a "${1}" != "-c" ; then 
  1308.   echo shar: Will not clobber existing file \"'init.sample'\"
  1309. else
  1310.   echo shar: Extracting \"'init.sample'\" \(2435 characters\)
  1311.   sed "s/^X//" >'init.sample' <<'END_OF_FILE'
  1312. X######################### GLOBAL INIT FILE ##################
  1313. X#
  1314. X#    Examine this sample init file before installing it
  1315. X#    It may set variables or define a presentation sequence
  1316. X#    which is inadequate for you.
  1317. X
  1318. X
  1319. X############################ VARIABLES ##########################
  1320. X#
  1321. X#    These are some of the variables you may want to set-up globally.
  1322. X#    Check with the manual to see if you really need them!
  1323. X
  1324. X# set bug-report-address uunet!dkuug.dk!nn-bugs
  1325. Xset default-distribution local
  1326. Xset default-save-file +$G
  1327. Xset header-lines _FODn=S
  1328. Xset include-art-id
  1329. Xset mail-format
  1330. Xset mark-overlap
  1331. Xset save-counter .%02d
  1332. X
  1333. X# set this if you use NFS (and specify -y2 on nnmaster as well):
  1334. X# set retry-on-error 2
  1335. X
  1336. X################# DEFAULT PRESENTATION SEQUENCE ####################
  1337. X#
  1338. X#    Adapt this to your local preferences.
  1339. X#    Users can override this sequence in their own init file.
  1340. X#
  1341. X#    **** THIS IS JUST AN EXAMPLE TO SHOW THE POSSIBILITIES    ****
  1342. X#    **** IT IS DEFINITELY NOT WHAT YOU WANT TO HAVE HERE    ****
  1343. X#    **** IF YOU DON'T KNOW WHAT TO PUT HERE, YOU ARE BETTER    ****
  1344. X#    **** OFF JUST DELETING THE REST OF THIS FILE !!!!!    ****
  1345. X
  1346. Xsequence
  1347. X
  1348. X    # groups everybody should read first (local groups)
  1349. X< texas*
  1350. X< general
  1351. X
  1352. X    # If you include the following !! line, users without their own
  1353. X    # init file will only get the local groups specified above!
  1354. X    #
  1355. X    # Other users will have to include a @ in their private presentation
  1356. X    # sequence to disable the '!!' operator entirely, or they can
  1357. X    # include the (few) groups they want to see.
  1358. X# !!
  1359. X
  1360. X    # also put local test first -- if users want to experiment, they want
  1361. X    # to see the results immediately.
  1362. X< test
  1363. X
  1364. X    # ignore some groups for ordinary users; anybody can get these
  1365. X    # by including them in their own init file.
  1366. X
  1367. X    # ignore non-local test groups
  1368. X! .test
  1369. X    # ignore offensive groups
  1370. X! alt.sex*
  1371. X! .bizarre
  1372. X! rec.humor
  1373. X
  1374. X    # the default sequence for the other groups
  1375. X    # subgroups are presented in alphabetical order
  1376. X
  1377. X    # danish/scandinavian groups
  1378. Xdk.
  1379. Xnordunet.
  1380. X
  1381. X
  1382. X    # european groups
  1383. X    # read eunet.general before eunet.followup and other eunet groups
  1384. Xeunet.general
  1385. Xeunet.followup
  1386. Xeunet.
  1387. X
  1388. X    # new groups are presented here
  1389. X    # use ! NEW to ignore new groups entirely!
  1390. XNEW
  1391. X
  1392. X    # world groups - prefer technical groups to other groups.
  1393. Xnews.
  1394. Xcomp.
  1395. Xsci.
  1396. Xgnu.
  1397. Xbionet.
  1398. Xalt.
  1399. Xrec.
  1400. Xmisc.
  1401. Xtalk.
  1402. X
  1403. X    # delay junk (we then only see non-cross postings.)
  1404. X> junk
  1405. X
  1406. X# groups that are not mentioned above will be shown here in alphabetical
  1407. X# order
  1408. X
  1409. X
  1410. END_OF_FILE
  1411.   if test 2435 -ne `wc -c <'init.sample'`; then
  1412.     echo shar: \"'init.sample'\" unpacked with wrong size!
  1413.   fi
  1414.   # end of 'init.sample'
  1415. fi
  1416. if test -f 'man/nncheck.1' -a "${1}" != "-c" ; then 
  1417.   echo shar: Will not clobber existing file \"'man/nncheck.1'\"
  1418. else
  1419.   echo shar: Extracting \"'man/nncheck.1'\" \(2757 characters\)
  1420.   sed "s/^X//" >'man/nncheck.1' <<'END_OF_FILE'
  1421. X.TH NNCHECK 1 "Release 6.4"
  1422. X.\" (c) Copyright 1988, 1990, Kim F. Storm.  All rights reserved.
  1423. X.UC 4
  1424. X.SH NAME
  1425. Xnncheck \- check for unread articles
  1426. X.SH SYNOPSIS
  1427. X.B nncheck
  1428. X[ -Q -r -t ]  [ -f format ]
  1429. X.SH DESCRIPTION
  1430. X.I nncheck
  1431. Xwill report if there are some articles on the system which you have not read.
  1432. X.LP
  1433. XWithout options, \fInncheck\fP will simply print a message reporting
  1434. Xthe number of unread articles with the following format:
  1435. X.br
  1436. X    There are 327 unread articles in 25 groups
  1437. X.br
  1438. Xand when there are no unread articles, the following message will be
  1439. Xprinted:
  1440. X.br
  1441. X    No News (is good news)
  1442. X.LP
  1443. X\fInncheck\fP will exit with a value of 0 if there are unread
  1444. Xarticles, and 99 if there is no news (see the exception for the \-r
  1445. Xoption.)
  1446. X.LP
  1447. XIt is important to notice that even though unread articles have been
  1448. Xreported by \fInncheck\fP, the actual number of unread articles may be
  1449. Xmuch lower (or even zero) when \fInn\fP is invoked to read
  1450. Xthe articles.  This is because the calculation of the number of unread
  1451. Xarticles is only based on recorded article number intervals.  Invoking
  1452. X\fInn\fP to read the articles may reveal that the articles have
  1453. Xpreviously been read in another news group, have been expired, or are
  1454. X.I killed
  1455. Xusing the
  1456. X.I auto-kill
  1457. Xfacility.
  1458. X.LP
  1459. XThe following options are used to modify the amount and format of the
  1460. Xoutput from \fInncheck\fP:
  1461. X.TP
  1462. X.B \-Q
  1463. XQuiet operation.  No output is produced, only the exit status indicate
  1464. Xwhether there is unread news.
  1465. X.TP
  1466. X.B \-t
  1467. XPrint the name of each group with unread articles, and how many unread
  1468. Xarticles there are (not counting split digests!).
  1469. X.TP
  1470. X.B \-r
  1471. XOutput a single integer value specifying the number of unread
  1472. Xarticles, and exit with a 0 status (somebody told me this would be
  1473. Xuseful).
  1474. X.TP
  1475. X\&\-\fBf\fP \fIformat\fP
  1476. XOutput the number of unread articles using the specified format.  The
  1477. Xformat is a text that may contain the following %-escapes:
  1478. X.sp 0.5v
  1479. X.DT
  1480. X.ta 1i 2i
  1481. X.\"ta 1 10 20
  1482. X.nf
  1483. X    \fB%-code\fP    \fBresulting output\fP
  1484. X.sp 0.5v
  1485. X    %u    "\fIuuu\fP unread articles"
  1486. X    %g    "\fIggg\fP groups"
  1487. X    %i    "is" if 1 unread article, else "are"
  1488. X    %U    "\fIuuu\fP"
  1489. X    %G    "\fIggg\fP"
  1490. X.fi
  1491. X.DT
  1492. X.sp 0.5v
  1493. Xwhere
  1494. X.I uuu
  1495. Xis the number of unread articles, and
  1496. X.I ggg
  1497. Xis the number of groups with unread articles.
  1498. X.sp 0.5v
  1499. XFor example, the default output format is
  1500. X.br
  1501. X    "There %i %u in %g"
  1502. X.br
  1503. Xwhich I prefer to the following less perfect format:
  1504. X.br
  1505. X    "There are %U unread article(s) in %G group(s)"
  1506. X.LP
  1507. X.SH FILES
  1508. X.DT
  1509. X.ta \w'$db/MASTER'u+6m
  1510. X.\"ta 0 12
  1511. X~/.nn/rc    The record of read articles
  1512. X.br
  1513. X$db/MASTER    The database master index
  1514. X.DT
  1515. X.SH SEE ALSO
  1516. Xnn(1), nngoback(1), nngrep(1), nntidy(1)
  1517. X.br
  1518. Xnnadmin(1M), nnquery(1M), nnusage(1M), nnmaster(1M)
  1519. X.SH AUTHOR
  1520. XKim F. Storm, Texas Instruments A/S, Denmark
  1521. X.br
  1522. XE-mail: storm@texas.dk
  1523. END_OF_FILE
  1524.   if test 2757 -ne `wc -c <'man/nncheck.1'`; then
  1525.     echo shar: \"'man/nncheck.1'\" unpacked with wrong size!
  1526.   fi
  1527.   # end of 'man/nncheck.1'
  1528. fi
  1529. if test -f 'man/nngrep.1' -a "${1}" != "-c" ; then 
  1530.   echo shar: Will not clobber existing file \"'man/nngrep.1'\"
  1531. else
  1532.   echo shar: Extracting \"'man/nngrep.1'\" \(2688 characters\)
  1533.   sed "s/^X//" >'man/nngrep.1' <<'END_OF_FILE'
  1534. X.TH NNGREP 1 "Release 6.4"
  1535. X.\" (c) Copyright 1988, 1990, Kim F. Storm.  All rights reserved.
  1536. X.UC 4
  1537. X.SH NAME
  1538. Xnngrep \- grep for news group names (nn)
  1539. X.SH SYNOPSIS
  1540. X.B nngrep
  1541. X[ \-\fBainprsu\fP ]
  1542. X[ \-\fBl\fP ]
  1543. X[ \fIpattern\fP ]
  1544. X.SH DESCRIPTION
  1545. X\fInngrep\fP can print various selections of the available news
  1546. Xgroups.
  1547. X.LP
  1548. XWithout options, \fInngrep\fP will list all currently \fIsubscribed\fP
  1549. Xnewsgroups whose name matches any of the specified \fIpatterns\fP.  If
  1550. Xno pattern is specified, all subscribed groups will be listed.
  1551. X.LP
  1552. XThe selection of news groups against which the patterns are matches,
  1553. Xand subsequently printed by \fInngrep\fP can be limited or
  1554. Xexpanded using the following command line options and arguments:
  1555. X.TP
  1556. X\fB\-a\fP
  1557. XUse \fIboth\fP subscribed and unsubscribed groups.  Overrides the
  1558. X\fB\-u\fP option.
  1559. X.TP
  1560. X\fB\-i\fP
  1561. XUse only \fIignored\fP groups, i.e. which are \fInot\fP in the
  1562. Xpresentation sequence.
  1563. X.TP
  1564. X\fB\-n\fP
  1565. XUse only \fInew\fP groups.  Notice that \fInn\fP considers a group to
  1566. Xbe new until you have read at least one article in the group, or you
  1567. Xhave unsubscribed to the group.  This means that even reasonable
  1568. Xactive news groups may remain "new" for quite some time if it only
  1569. Xcontains articles which are cross-posted to other groups which occur
  1570. Xearlier in your presentation sequence.
  1571. X.TP
  1572. X\fB\-p\fP
  1573. XUse only groups with \fIunread\fP (pending) articles.
  1574. X.TP
  1575. X\fB\-r\fP
  1576. XUse only \fIread\fP groups, i.e. without unread articles.
  1577. X.TP
  1578. X\fB\-s\fP
  1579. XUse only groups which are in the presentation \fIsequence\fP.
  1580. X.TP
  1581. X\fB\-u\fP
  1582. XUse only \fIunsubscribed\fP groups.
  1583. X.LP
  1584. XThese options can be combined if they don't logically exclude each
  1585. Xother.
  1586. X.LP
  1587. XFor example, to get the names of all "source" groups, you can use the
  1588. Xcommand
  1589. X.br
  1590. X    nngrep source
  1591. X.LP
  1592. XYou can use this to read a specific subset of news groups with
  1593. X\fInn\fP; for example
  1594. X.br
  1595. X    nn `nngrep -sp source`
  1596. X.SH LONG LISTING
  1597. XA \fIlong\fP listing of the matched groups can be requested with the
  1598. X\fB\-l\fP option.  It will include the following information:
  1599. X.LP
  1600. X.DT
  1601. X.ta \w'SEQUENCE'u+3m
  1602. X.\"ta 0 12
  1603. XSUBSCR    Specifies whether the group is subscribed or not (yes/no).
  1604. X.br
  1605. XNEW    Specifies whether the group is new or not (yes/no).
  1606. X.br
  1607. XUNREAD    Shows the number of unread articles in the group (if any).
  1608. X.br
  1609. XSEQUENCE    Shows the group's index in the presentation sequence.
  1610. X.br
  1611. XGROUP    The name of the group.
  1612. X.br
  1613. X.DT
  1614. X.SH FILES
  1615. X.DT
  1616. X.ta \w'~/.nn/init'u+3m
  1617. X.\"ta 0 12
  1618. X~/.newsrc    The record of read articles
  1619. X.br
  1620. X~/.nn/init    The presentation sequence
  1621. X.DT
  1622. X.SH SEE ALSO
  1623. Xnn(1), nncheck(1), nngoback(1), nngrep(1)
  1624. X.br
  1625. Xnnadmin(1M), nnquery(1M), nnusage(1M), nnmaster(8)
  1626. X.SH AUTHOR
  1627. XKim F. Storm, Texas Instruments A/S, Denmark
  1628. X.br
  1629. XE-mail: storm@texas.dk
  1630. X
  1631. END_OF_FILE
  1632.   if test 2688 -ne `wc -c <'man/nngrep.1'`; then
  1633.     echo shar: \"'man/nngrep.1'\" unpacked with wrong size!
  1634.   fi
  1635.   # end of 'man/nngrep.1'
  1636. fi
  1637. if test -f 'match.c' -a "${1}" != "-c" ; then 
  1638.   echo shar: Will not clobber existing file \"'match.c'\"
  1639. else
  1640.   echo shar: Extracting \"'match.c'\" \(2864 characters\)
  1641.   sed "s/^X//" >'match.c' <<'END_OF_FILE'
  1642. X/*
  1643. X *    (c) Copyright 1990, Kim Fabricius Storm.  All rights reserved.
  1644. X *
  1645. X *    String/Subject matching routines.
  1646. X */
  1647. X
  1648. X#include "config.h"
  1649. X#include "regexp.h"
  1650. X
  1651. Xexport int case_fold_search = 1;
  1652. X
  1653. X#define MAXFOLD    256    /* max length of any string */
  1654. X
  1655. X/*
  1656. X *    Systems which have a tolower(c) function which is defined for
  1657. X *    all characters, but no _tolower(c) macro which works for
  1658. X *    isupper(c) only, may define HAVE_GENERIC_TOLOWER -- it
  1659. X *    may give a slight speed-up, but is not mandatory.
  1660. X */
  1661. X
  1662. X#ifndef HAVE_GENERIC_TOLOWER
  1663. X#ifndef _tolower
  1664. X#define _tolower(c) tolower(c)
  1665. X#endif
  1666. X#endif
  1667. X
  1668. Xfold_string(mask)    /* convert mask to lower-case */
  1669. Xregister char *mask;
  1670. X{
  1671. X    register char c;
  1672. X
  1673. X    for ( ; c = *mask; mask++) {
  1674. X#ifdef _tolower
  1675. X    if (!isascii(c) || !isupper(c)) continue;
  1676. X    *mask = _tolower(c);
  1677. X#else
  1678. X    *mask = tolower(c);
  1679. X#endif
  1680. X    }
  1681. X}
  1682. X
  1683. Xstreq_fold(mask, str)        /* mask is prefix of str - FOLD */
  1684. Xregister char *mask, *str;
  1685. X{
  1686. X    register char c, d;
  1687. X
  1688. X    while (d = *mask++) {
  1689. X    if ((c = *str++) == NUL) return 0;
  1690. X    if (c == d) continue;
  1691. X#ifdef _tolower
  1692. X    if (!isascii(c) || !isupper(c) || _tolower(c) != d) return 0;
  1693. X#else
  1694. X    if (tolower(c) != d) return 0;
  1695. X#endif
  1696. X    }
  1697. X    return c == NUL ? 1 : 2;
  1698. X}
  1699. X
  1700. Xstrmatch_fold(mask, str)    /* mask occurs anywhere in str - FOLD */
  1701. Xchar *mask;
  1702. Xregister char *str;
  1703. X{
  1704. X    register char c, m1 = *mask++;
  1705. X
  1706. X    for (;;) {
  1707. X    while (c = *str++) {    /* find first occ. of mask[0] in str. */
  1708. X        if (c == m1) break;
  1709. X#ifdef _tolower
  1710. X        if (!isascii(c) || !isupper(c)) continue;
  1711. X        if (_tolower(c) == m1) break;
  1712. X#else
  1713. X        if (tolower(c) == m1) break;
  1714. X#endif
  1715. X    }
  1716. X    if (c == NUL) return 0;
  1717. X    if (streq_fold(mask, str)) return 1;
  1718. X    }
  1719. X}
  1720. X
  1721. Xstrmatch(mask, str)        /* mask occurs anywhere in str - CASE */
  1722. Xchar *mask;
  1723. Xregister char *str;
  1724. X{
  1725. X    register char *q, *m;
  1726. X    register char m1 = *mask;
  1727. X
  1728. X    for (; *str; str++) {
  1729. X    if (*str != m1) continue;
  1730. X
  1731. X    q = str; m = mask;
  1732. X    do
  1733. X        if (*++m == NUL) return 1;
  1734. X    while (*++q == *m);
  1735. X    }
  1736. X    return 0;
  1737. X}
  1738. X
  1739. Xstrmatch_cf(mask, str)        /* fold if case_fold_search is set */
  1740. Xchar *mask;
  1741. Xchar *str;
  1742. X{
  1743. X    if (case_fold_search)
  1744. X    return strmatch_fold(mask, str);
  1745. X
  1746. X    return strmatch(mask, str);
  1747. X}
  1748. X
  1749. X/*
  1750. X *    case insensitive regexp matching
  1751. X */
  1752. X
  1753. Xint regexec_fold(prog, string)
  1754. Xregister regexp *prog;
  1755. Xchar  *string;
  1756. X{
  1757. X    char buf[256];
  1758. X    register char c, *bp, *str, *maxb;
  1759. X
  1760. X    bp = buf, maxb = &buf[255];
  1761. X    str = string;
  1762. X    while (bp < maxb && (c = *str++) != NUL)
  1763. X#ifdef _tolower
  1764. X    *bp++ = (!isascii(c) || !isupper(c)) ? c : _tolower(c);
  1765. X#else
  1766. X    *bp++ = tolower(c);
  1767. X#endif
  1768. X    *bp = NUL;
  1769. X
  1770. X    if (!regexec(prog, buf)) return 0;
  1771. X
  1772. X    prog->startp[0] = string + (prog->startp[0] - buf);
  1773. X    prog->endp[0] = string + (prog->endp[0] - buf);
  1774. X    return 1;
  1775. X}
  1776. X
  1777. Xint regexec_cf(prog, string)
  1778. Xregister regexp *prog;
  1779. Xchar  *string;
  1780. X{
  1781. X    if (case_fold_search)
  1782. X    return regexec_fold(prog, string);
  1783. X
  1784. X    return regexec(prog, string);
  1785. X}
  1786. X
  1787. END_OF_FILE
  1788.   if test 2864 -ne `wc -c <'match.c'`; then
  1789.     echo shar: \"'match.c'\" unpacked with wrong size!
  1790.   fi
  1791.   # end of 'match.c'
  1792. fi
  1793. if test -f 'nnstats.sh' -a "${1}" != "-c" ; then 
  1794.   echo shar: Will not clobber existing file \"'nnstats.sh'\"
  1795. else
  1796.   echo shar: Extracting \"'nnstats.sh'\" \(3021 characters\)
  1797.   sed "s/^X//" >'nnstats.sh' <<'END_OF_FILE'
  1798. X# --- prefix is inserted above by make ---
  1799. X#
  1800. X# Extract collection & expiration statistics from Log file.
  1801. X#
  1802. X# From: Mark Moraes <moraes@csri.toronto.edu>
  1803. X#
  1804. X# Heavily modified by Kim F. Storm:
  1805. X#  Added expiration statistics
  1806. X#  Will now make daily statistics & grand summary
  1807. X#  Split into two awk scripts to fit in argument list space
  1808. X#  (and as a side-effect to be able to use functions in old awk!!!)
  1809. X
  1810. XCHECK="0>0"
  1811. XLONG=0
  1812. XSUMMARY=1
  1813. Xdebug=false
  1814. X
  1815. XLOOP=true
  1816. Xwhile $LOOP; do
  1817. X  case "$1" in
  1818. X  -l)    LONG=1
  1819. X    shift;;
  1820. X  -d)    CHECK="\$2!=\"$2\" || \$3!=\"$3\""
  1821. X    shift; shift; shift;;
  1822. X  -m)    CHECK="\$2!=\"$2\""
  1823. X    shift; shift;;
  1824. X  -t)   SUMMARY=0
  1825. X    shift;;
  1826. X  -D)    debug=true
  1827. X    shift;;
  1828. X  -*)   echo "unknown option: $1"
  1829. X    exit 1;;
  1830. X  *)    LOOP=false
  1831. X    ;;
  1832. X  esac
  1833. Xdone
  1834. X
  1835. Xgrep '^[CX]:' `ls -tr ${@-$LOG}` |
  1836. X${AWK} 'BEGIN{
  1837. X  day="0"; l='$LONG'; t='$SUMMARY'
  1838. X  f=" %d %d %d %d %d %d %d\n"
  1839. X}
  1840. X'"$CHECK"' { next }
  1841. Xday!=$3{
  1842. X  if(day!="0")print "d " date
  1843. X  if(l && day!="0" && (run>0 || xrun>0)){
  1844. X    print "h"
  1845. X    printf "c" f,run,art,Mart,gr,Mgr,sec,Msec
  1846. X    printf "e" f,xrun,xart,xMart,xgr,xMgr,xsec,xMsec
  1847. X  }
  1848. X  day=$3
  1849. X  date=$2 " " $3
  1850. X  run=art=gr=sec=0
  1851. X  Mart=Mgr=Msec=0
  1852. X  xrun=xart=xgr=xsec=0
  1853. X  xMart=xMgr=xMsec=0
  1854. X}
  1855. X$6=="Collect:" {
  1856. X  if ($7 <= 0) next
  1857. X  run++; art+=$7; gr+=$9; sec+=$11
  1858. X  Trun++; Tart+=$7; Tgr+=$9; Tsec+=$11
  1859. X  if ($7 > Mart) Mart=$7;
  1860. X  if ($9 > Mgr) Mgr=$9;
  1861. X  if ($11 > Msec) Msec=$11;
  1862. X  if ($11 > 0) A=$7 / $11; else A=$7;
  1863. X  if (A > Mps) Mps=A;
  1864. X  next
  1865. X}
  1866. X$6=="Expire:" {
  1867. X  if ($7 <= 0) next
  1868. X  xrun++; xart+=$7; xgr+=$9; xsec+=$11
  1869. X  xTrun++; xTart+=$7; xTgr+=$9; xTsec+=$11
  1870. X  if ($7 > xMart) xMart=$7
  1871. X  if ($9 > xMgr) xMgr=$9
  1872. X  if ($11 > xMsec) xMsec=$11
  1873. X  if ($11 > 0) A=$7 / $11; else A=$7
  1874. X  if (A > xMps) xMps=A
  1875. X  next
  1876. X}
  1877. XEND{
  1878. X  if (day == "0") { print "Z"; exit }
  1879. X  print "d " date
  1880. X  if (l && (run > 0 || xrun > 0)) {
  1881. X    print "h"
  1882. X    printf "c" f,run,art,Mart,gr,Mgr,sec,Msec
  1883. X    printf "e" f,xrun,xart,xMart,xgr,xMgr,xsec,xMsec
  1884. X  }
  1885. X  if (t) {
  1886. X    print "H"
  1887. X    printf "C %d %d %d %d\n",Trun,Tart,Tsec,Mps
  1888. X    printf "E %d %d %d %d\n",xTrun,xTart,xTsec,xMps
  1889. X  }
  1890. X}' |
  1891. Xif $debug ; then
  1892. X  cat
  1893. Xelse
  1894. X${AWK} 'BEGIN{
  1895. X first=""
  1896. X}
  1897. X/^d/{
  1898. X last=$2 " " $3
  1899. X if (first == "") first=last
  1900. X next
  1901. X}
  1902. X/^h/{
  1903. X printf "\nStatistics for %s\n", last
  1904. X next
  1905. X}
  1906. X/^H/{
  1907. X tostr=""
  1908. X if (first != last) tostr=" to " last
  1909. X printf "\nSummary for %s%s:\n", first, tostr
  1910. X next
  1911. X}
  1912. X/^[cC]/{tp="Collection"}
  1913. X/^[eE]/{tp="Expiration"}
  1914. X/^[ce]/{
  1915. X if ($2 == 0) next
  1916. X printf "\n  %s runs: %d\n", tp, $2
  1917. X printf "%10d articles, average of %5d per run, maximum %6d\n", $3, $3/$2, $4
  1918. X printf "%10d groups,   average of %5d per run, maximum %6d\n", $5, $5/$2, $6
  1919. X printf "%10d seconds,  average of %5d per run, maximum %6d\n", $7, $7/$2, $8
  1920. X next
  1921. X}
  1922. X/^[CE]/{
  1923. X printf "\n  %s runs: %d\n", tp, $2
  1924. X if ($2 == 0) next
  1925. X printf "%10d articles, average of %5d per run\n", $3, $3/$2
  1926. X printf "%10d seconds,  average of %5d per run\n", $4, $4/$2
  1927. X if ($4>0) avg=$3/$4; else avg=$3
  1928. X printf "    average of %d articles per second, maximum %d\n", avg, $5
  1929. X}
  1930. X/^Z/{
  1931. X printf "Log is empty\n"
  1932. X}'
  1933. Xfi
  1934. X
  1935. END_OF_FILE
  1936.   if test 3021 -ne `wc -c <'nnstats.sh'`; then
  1937.     echo shar: \"'nnstats.sh'\" unpacked with wrong size!
  1938.   fi
  1939.   # end of 'nnstats.sh'
  1940. fi
  1941. if test -f 'nntp.h' -a "${1}" != "-c" ; then 
  1942.   echo shar: Will not clobber existing file \"'nntp.h'\"
  1943. else
  1944.   echo shar: Extracting \"'nntp.h'\" \(2530 characters\)
  1945.   sed "s/^X//" >'nntp.h' <<'END_OF_FILE'
  1946. X/*
  1947. X * Response codes for NNTP server
  1948. X *
  1949. X * @(#)nntp.h    1.7    (Berkeley) 1/11/88
  1950. X *
  1951. X * First digit:
  1952. X *
  1953. X *    1xx    Informative message
  1954. X *    2xx    Command ok
  1955. X *    3xx    Command ok so far, continue
  1956. X *    4xx    Command was correct, but couldn't be performed
  1957. X *        for some specified reason.
  1958. X *    5xx    Command unimplemented, incorrect, or a
  1959. X *        program error has occured.
  1960. X *
  1961. X * Second digit:
  1962. X *
  1963. X *    x0x    Connection, setup, miscellaneous
  1964. X *    x1x    Newsgroup selection
  1965. X *    x2x    Article selection
  1966. X *    x3x    Distribution
  1967. X *    x4x    Posting
  1968. X */
  1969. X
  1970. X#define    CHAR_INF    '1'
  1971. X#define    CHAR_OK        '2'
  1972. X#define    CHAR_CONT    '3'
  1973. X#define    CHAR_ERR    '4'
  1974. X#define    CHAR_FATAL    '5'
  1975. X
  1976. X#define    INF_HELP    100    /* Help text on way */
  1977. X#define    INF_DEBUG    199    /* Debug output */
  1978. X
  1979. X#define    OK_CANPOST    200    /* Hello; you can post */
  1980. X#define    OK_NOPOST    201    /* Hello; you can't post */
  1981. X#define    OK_SLAVE    202    /* Slave status noted */
  1982. X#define    OK_GOODBYE    205    /* Closing connection */
  1983. X#define    OK_GROUP    211    /* Group selected */
  1984. X#define    OK_GROUPS    215    /* Newsgroups follow */
  1985. X#define    OK_ARTICLE    220    /* Article (head & body) follows */
  1986. X#define    OK_HEAD        221    /* Head follows */
  1987. X#define    OK_BODY        222    /* Body follows */
  1988. X#define    OK_NOTEXT    223    /* No text sent -- stat, next, last */
  1989. X#define    OK_NEWNEWS    230    /* New articles by message-id follow */
  1990. X#define    OK_NEWGROUPS    231    /* New newsgroups follow */
  1991. X#define    OK_XFERED    235    /* Article transferred successfully */
  1992. X#define    OK_POSTED    240    /* Article posted successfully */
  1993. X
  1994. X#define CONT_XFER    335    /* Continue to send article */
  1995. X#define    CONT_POST    340    /* Continue to post article */
  1996. X
  1997. X#define    ERR_GOODBYE    400    /* Have to hang up for some reason */
  1998. X#define    ERR_NOGROUP    411    /* No such newsgroup */
  1999. X#define    ERR_NCING    412    /* Not currently in newsgroup */
  2000. X#define    ERR_NOCRNT    420    /* No current article selected */
  2001. X#define    ERR_NONEXT    421    /* No next article in this group */
  2002. X#define    ERR_NOPREV    422    /* No previous article in this group */
  2003. X#define    ERR_NOARTIG    423    /* No such article in this group */
  2004. X#define ERR_NOART    430    /* No such article at all */
  2005. X#define ERR_GOTIT    435    /* Already got that article, don't send */
  2006. X#define ERR_XFERFAIL    436    /* Transfer failed */
  2007. X#define    ERR_XFERRJCT    437    /* Article rejected, don't resend */
  2008. X#define    ERR_NOPOST    440    /* Posting not allowed */
  2009. X#define    ERR_POSTFAIL    441    /* Posting failed */
  2010. X
  2011. X#define    ERR_COMMAND    500    /* Command not recognized */
  2012. X#define    ERR_CMDSYN    501    /* Command syntax error */
  2013. X#define    ERR_ACCESS    502    /* Access to server denied */
  2014. X#define ERR_FAULT    503    /* Program fault, command not performed */
  2015. X
  2016. X/* RFC 977 defines this; don't change it. */
  2017. X
  2018. X#define    NNTP_STRLEN    512
  2019. END_OF_FILE
  2020.   if test 2530 -ne `wc -c <'nntp.h'`; then
  2021.     echo shar: \"'nntp.h'\" unpacked with wrong size!
  2022.   fi
  2023.   # end of 'nntp.h'
  2024. fi
  2025. echo shar: End of archive 20 \(of 22\).
  2026. cp /dev/null ark20isdone
  2027. MISSING=""
  2028. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ; do
  2029.     if test ! -f ark${I}isdone ; then
  2030.     MISSING="${MISSING} ${I}"
  2031.     fi
  2032. done
  2033. if test "${MISSING}" = "" ; then
  2034.     echo You have unpacked all 22 archives.
  2035.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2036. else
  2037.     echo You still must unpack the following archives:
  2038.     echo "        " ${MISSING}
  2039. fi
  2040. exit 0
  2041.  
  2042.